// 引入路由组件
import Home from '@/pages/Home'
import Search from '@/pages/Search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import Cart from '@/pages/Cart'
import Trade from '@/pages/Trade'
import Pay from '@/pages/Pay'
import PaySuccess from '@/pages/PaySuccess'
import Center from '@/pages/Center'
import MyOrder from '@/pages/Center/MyOrder'
import GroupOrder from '@/pages/Center/GroupOrder'

export default [
    // 个人中心
    {
        path: "/center",
        component: Center,
        meta: {
            show: true
        },
        // 二级路由组件
        children:[
            {
                path: "/center/myorder",
                component: MyOrder,
            },
            {
                path: "/center/grouporder",
                component: GroupOrder,
            },
            {
                path: "*",
                component: MyOrder,
            }
        ]
    },
    {
        path: "/home",
        component: Home,
        meta: {
            show: true
        }
    },
    {
        name: "search",
        path: "/search/:keyword?",
        component: Search,
        meta: {
            show: true
        }
    },
    {
        path: "/login",
        component: Login
    },
    {
        path: "/register",
        component: Register
    },
    // 重定向
    {
        path: "*",
        redirect: "/home"
    },
    // 商品详情页
    {
        path: "/detail/:skuid",
        component: Detail,
        meta: {
            show: true
        }
    },
    // 添加购物车成功页
    {
        name:"addcartsuccess",
        path: "/addcartsuccess",
        component: AddCartSuccess,
        meta: {
            show: true
        }
    },
    // 我的购物车列表
    {
        name:"cart",
        path: "/cart",
        component: Cart,
        meta: {
            show: true
        }
    },
    // 交易页
    {
        name:"trade",
        path: "/trade",
        component: Trade,
        meta: {
            show: true
        }
    },
    // 支付页
    {
        name:"pay",
        path: "/pay",
        component: Pay,
        meta: {
            show: true
        }
    },
    // 支付页
    {
        name:"paysuccess",
        path: "/paysuccess",
        component: PaySuccess,
        meta: {
            show: true
        }
    },
]